package com.yunji.product.enums;

import java.util.Objects;

public enum GrantTypes {
    ALLOCATE(0, "指定代理商"),
    ALL_GRANT(1, "全部授予");
    private final Integer code;
    private final String text;

    GrantTypes(Integer type, String info) {
        this.code = type;
        this.text = info;
    }

    public Integer getCode() {
        return code;
    }

    public String getText() {
        return text;
    }

    public static String get(Integer code) {
        GrantTypes[] enums = GrantTypes.values();
        for (GrantTypes e : enums) {
            if (Objects.equals(e.code, code)) {
                return e.text;
            }
        }
        return null;
    }
}
